//
//  PSLinkedList.h
//  PrefCore
//
//  Created by Sergey on 5/6/14.
//  Copyright (c) 2014 Play-on-smart. All rights reserved.
//

#import <Foundation/Foundation.h>

@protocol PSListEntry <NSObject>

@property (nonatomic, readwrite) id <PSListEntry> previous;

@property (nonatomic, readwrite) id <PSListEntry> next;

@end

@interface PSLinkedList : NSObject

-(instancetype)init;

-(void)clear;

-(void)dealloc;

-(void)addFirst:(id<PSListEntry>) entry;

-(void)addLast:(id<PSListEntry>) entry;

-(void)moveAppend:(PSLinkedList*)list;

-(id<PSListEntry>)removeFirst;

-(id<PSListEntry>)removeLast;

-(void)remove:(id<PSListEntry>)entry;

@property (nonatomic, readonly) id<PSListEntry> first;

-(void)start;

@property (nonatomic, readonly) BOOL hasNextEntry;

@property (nonatomic, readonly) id<PSListEntry> nextEntry;

@property (nonatomic, readonly) NSUInteger count;

-(void)removeCurrentEntry;

-(NSString*)description;

@end
